// src/composables/useSticky.js

import { ref, onMounted, onBeforeUnmount } from 'vue';

export function useSticky(offset = 80) {
  const isSticky = ref(false);

  const handleScroll = () => {
    isSticky.value = window.scrollY > offset;
  };

  onMounted(() => {
    window.addEventListener('scroll', handleScroll);
  });

  onBeforeUnmount(() => {
    window.removeEventListener('scroll', handleScroll);
  });

  return {
    isSticky,
  };
}
